<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title> Master login Form Responsive Widget Template  :: w3layouts</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content=" Master  Login Form Widget Tab Form,Login Forms,Sign up Forms,Registration Forms,News letter Forms,Elements"/>
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<%--    <link href="//fonts.googleapis.com/css?family=Cormorant+SC:300,400,500,600,700" rel="stylesheet">--%>
<%--    <link href="//fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i" rel="stylesheet">--%>
</head>

<body>
<div class="padding-all">
    <div class="header">
        <h1>后台管理登录界面</h1>
    </div>

    <div class="design-w3l">
        <div class="mail-form-agile">
            <form method="post">
                <input type="text" name="name" placeholder="你的登录名..." required=""/>
                <input type="password"  name="password" class="padding" placeholder="你的密码..." required=""/>
                <input id="mb2" type="button" value="登录">
            </form>
        </div>
        <div class="clear"> </div>
    </div>

    <div class="footer">
        <p>© 2017  Master  Login form. All Rights Reserved | Design by </p>
    </div>
</div>
</body>
<script>
    $(document).ready(function () {
        $("#mb2").click(function () {
            var name = $("input[name='name']");
            var pass = $("input[name='password']");
            if(name.val()==""||pass.val()=="") {
                alert("登录名或密码不能为空")
            }else {
                $.ajax({
                    type:"post",
                    url:"adminLogin",
                    data:{"account":name.val(),"apass":pass.val()},
                    success:function (result) {
                        if(result.msg==0){
                            location.href = "index"
                        }else{
                            alert("登录失败，用户名或密码错误!")
                        }
                    },
                    dataType:"json"
                })
            }
        })
    })
</script>
</html>